from machine import Pin
from neopixel import NeoPixel
from utime import sleep_ms

# RGB颜色值
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
Aqua = (0, 255, 255)
Coral = (255, 127, 80)
Gold = (255, 215, 0)
Hot_Pink = (255, 105, 180)
Lavender = (230, 230, 250)
Lime = (0, 255, 0)
COLORS = (RED, GREEN, BLUE, Aqua, Coral, Gold, Hot_Pink, Lavender, Lime)

# 创建RGB_LED对象
leds_rgb = NeoPixel(Pin(16, Pin.OUT), 5)

if __name__ == "__main__":
    # 彩灯控制
    while True:
        for color in COLORS:
            leds_rgb[0] = (color[0], color[1], color[2])
            leds_rgb.write()
            sleep_ms(1000)
            #for idx in range(len(leds_rgb)):
            #   leds_rgb[idx] = (color[0], color[1], color[2])
            #   leds_rgb.write()
            #   sleep_ms(100)
            #sleep_ms(1000)
    
